import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)
// 路由表配置
const routes = [
  {
    path: '/login',
    name: 'login',
    component: () => import('@/views/login')
  },
  {
    path: '/search',
    name: 'search',
    component: () => import('@/views/search')
  },
  {
    path: '/article/:articleId',
    name: 'article',
    component: () => import('@/views/article'),
    props: true // 开启props传参
  },
  {
    path: '/user/profile',
    name: 'user-profile',
    component: () => import('@/views/user-pfofile')
  },
  {
    path: '/',
    name: 'layout',
    component: () => import('@/views/layout'),
    children: [
      {
        path: '',
        name: 'home',
        component: () => import('@/views/home')
      },
      {
        path: 'qa',
        name: 'qa',
        component: () => import('@/views/qa')
      },
      {
        path: 'video',
        name: 'video',
        component: () => import('@/views/video')
      },
      {
        path: 'my',
        name: 'my',
        component: () => import('@/views/my')
      }
    ]
  }
  // {
  //   path: '/tab-bar',
  //   name: 'tab-bar',
  //   component: () => import('@/views/tab-bar'),
  //   children: [
  //     {
  //       path: '',
  //       name: 'home',
  //       component: () => import('@/views/home')
  //     },
  //     {
  //       path: 'qa',
  //       name: 'qa',
  //       component: () => import('@/views/qa')
  //     },
  //     {
  //       path: 'vedio',
  //       name: 'vedio',
  //       component: () => import('@/views/vedio')
  //     },
  //     {
  //       path: 'my',
  //       name: 'my',
  //       component: () => import('@/views/my')
  //     },
  //   ]
  // }
]

const router = new VueRouter({
  routes
})

export default router
